Use more ES6-inspired check for classes initializations.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/503
class BaseAppView {
constructor(params, gridParams) {
- if (new.target === BaseAppView)
- throw new TypeError('Cannot instantiate abstract class ' + new.target.name);
+ if (this.constructor === BaseAppView)
+ throw new TypeError(`Cannot instantiate abstract class ${this.constructor.name}`);
gridParams = Params.parse(gridParams, { xAlign: St.Align.MIDDLE,
columnLimit: MAX_COLUMNS,
var PopupMenuBase = class {
constructor(sourceActor, styleClass) {
- if (new.target === PopupMenuBase)
- throw new TypeError('Cannot instantiate abstract class ' + new.target.name);
+ if (this.constructor === PopupMenuBase)
+ throw new TypeError(`Cannot instantiate abstract class ${this.constructor.name}`);
this.sourceActor = sourceActor;
this._parent = null;
var InputSourceSettings = class {
constructor() {
- if (new.target === InputSourceSettings)
- throw new TypeError('Cannot instantiate abstract class ' + new.target.name);
+ if (this.constructor === InputSourceSettings)
+ throw new TypeError(`Cannot instantiate abstract class ${this.constructor.name}`);
}
_emitInputSourcesChanged() {
};
Signals.addSignalMethods(NMConnectionItem.prototype);
-var NMConnectionSection = class {
+var NMConnectionSection = class NMConnectionSection {
constructor(client) {
- if (new.target === NMConnectionSection)
- throw new TypeError('Cannot instantiate abstract type ' + new.target.name);
+ if (this.constructor === NMConnectionSection)
+ throw new TypeError(`Cannot instantiate abstract type ${this.constructor.name}`);
this._client = client;
};
Signals.addSignalMethods(NMConnectionSection.prototype);
-var NMConnectionDevice = class extends NMConnectionSection {
+var NMConnectionDevice = class NMConnectionDevice extends NMConnectionSection {
constructor(client, device) {
- if (new.target === NMConnectionDevice)
- throw new TypeError('Cannot instantiate abstract type ' + new.target.name);
-
super(client);
+
+ if (this.constructor === NMConnectionDevice)
+ throw new TypeError(`Cannot instantiate abstract type ${this.constructor.name}`);
+
this._device = device;
this._description = '';
var LayoutStrategy = class {
constructor(monitor, rowSpacing, columnSpacing) {
- if (new.target === LayoutStrategy)
- throw new TypeError('Cannot instantiate abstract type ' + new.target.name);
+ if (this.constructor === LayoutStrategy)
+ throw new TypeError(`Cannot instantiate abstract type ${this.constructor.name}`);
this._monitor = monitor;
this._rowSpacing = rowSpacing;